#include "process.h"

#include <unistd.h>
#include <stdlib.h>
#include <time.h>

void DownLoad()
{
    double total = 1024.0;
    double current = 0.0;
    double speed = 1.0;

    while(current <= total)
    {
        FflushProcess(current, total);
        srand(time(0));
        int RandomNum = rand() % 100000 + 1000;
        usleep(RandomNum); //充当下载数据
        current += speed;
    }
    printf("\nDownload %.2lfMB done!\n", total);
}

int main()
{
    //process_v1();
    
    DownLoad();
    DownLoad();
    DownLoad();

    return 0;
}
